package user

import (
	"context"
	"srv/config"
	"srv/internal/model/dao"
	__ "srv/proto"
)

// 实现方法
func (s *UserService) GvaExamTitleAdd(ctx context.Context, req *__.GvaExamTitleAddRequest) (resp *__.GvaExamTitleAddResponse, err error) {
	title := dao.GvaExamTitle{
		Name:          req.Name,
		ExamTitleType: int8(req.ExamTitleType),
		TitleOrigin:   int8(req.TitleOrigin),
		TitleNum:      int(req.TitleNum),
		CreateName:    req.CreateName,
		Open:          int8(req.Open),
	}
	config.DB.Create(&title)
	return &__.GvaExamTitleAddResponse{Id: int64(title.ID)}, nil
}
